/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bean.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
//import org.eclipse.persistence.queries.StoredProcedureCall ;

import javax.persistence.OneToMany;
import javax.persistence.Query;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author server
 */
@Entity
@Table(name = "Vacances")
@NamedQueries({
    @NamedQuery(name = "Vacances.findAll", query = "SELECT v FROM Vacances v ORDER BY v.vaStatus ASC"),
    @NamedQuery(name = "Vacances.findByVacancyID", query = "SELECT v FROM Vacances v WHERE v.vacancyID = :vacancyID"),
    @NamedQuery(name = "Vacances.findByVacantyTitle", query = "SELECT v FROM Vacances v WHERE v.vacantyTitle like ?1 ORDER BY v.vaStatus ASC "),
    @NamedQuery(name = "Vacances.findByIDVacancy", query = "SELECT v FROM Vacances v WHERE v.vacancyID like ?1 ORDER BY v.vaStatus ASC "),
    @NamedQuery(name = "Vacances.findByDepartmentID", query = "SELECT v FROM Vacances v WHERE v.departments.departmentID LIKE ?1"),
    @NamedQuery(name = "Vacances.findBySalary", query = "SELECT v FROM Vacances v WHERE v.salary = :salary"), 
    @NamedQuery(name = "Vacances.findByExperience", query = "SELECT v FROM Vacances v WHERE v.experience = :experience"),
    @NamedQuery(name = "Vacances.findByStartDate", query = "SELECT v FROM Vacances v WHERE v.startDate = :startDate"),
    @NamedQuery(name = "Vacances.findByCloseDate", query = "SELECT v FROM Vacances v WHERE v.closeDate = :closeDate"),
    @NamedQuery(name = "Vacances.findByVaStatus", query = "SELECT v FROM Vacances v WHERE v.vaStatus = :vaStatus")})
public class Vacances implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "VacancyID")
    private String vacancyID;
    @Basic(optional = false)
    @Column(name = "VacantyTitle")
    private String vacantyTitle;
    @Basic(optional = false)
    @Column(name = "NumOfJob")
    private int numOfJob;
    @Basic(optional = false)
    @Column(name = "Salary")
    private String salary;
    @Basic(optional = false)
    @Column(name = "Experience")
    private String experience;
    @Column(name = "StartDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startDate;
    @Column(name = "CloseDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date closeDate;
    @Basic(optional = false)
    @Column(name = "VaStatus")
    private int vaStatus;
    @JoinColumn(name = "DepartmentID", referencedColumnName = "DepartmentID")
    @ManyToOne(optional = false)
    private Departments departments;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vacances")
    private Collection<Interviews> interviewsCollection;

    public Vacances() {
    }

    public Vacances(String vacancyID) {
        this.vacancyID = vacancyID;
    }

    public Vacances(String vacancyID, String vacantyTitle, int numOfJob, String salary, String experience, int vaStatus) {
        this.vacancyID = vacancyID;
        this.vacantyTitle = vacantyTitle;
        this.numOfJob = numOfJob;
        this.salary = salary;
        this.experience = experience;
        this.vaStatus = vaStatus;
    }

    public String getVacancyID() {
        return vacancyID;
    }

    public void setVacancyID(String vacancyID) {
        this.vacancyID = vacancyID;
    }

    public String getVacantyTitle() {
        return vacantyTitle;
    }

    public void setVacantyTitle(String vacantyTitle) {
        this.vacantyTitle = vacantyTitle;
    }

    public int getNumOfJob() {
        return numOfJob;
    }

    public void setNumOfJob(int numOfJob) {
        this.numOfJob = numOfJob;
    }

    public String getSalary() {
        return salary;
    }

    public void setSalary(String salary) {
        this.salary = salary;
    }

    public String getExperience() {
        return experience;
    }

    public void setExperience(String experience) {
        this.experience = experience;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    public int getVaStatus() {
        return vaStatus;
    }

    public void setVaStatus(int vaStatus) {
        this.vaStatus = vaStatus;
    }

    public Departments getDepartments() {
        return departments;
    }

    public void setDepartments(Departments departments) {
        this.departments = departments;
    }

    public Collection<Interviews> getInterviewsCollection() {
        return interviewsCollection;
    }

    public void setInterviewsCollection(Collection<Interviews> interviewsCollection) {
        this.interviewsCollection = interviewsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vacancyID != null ? vacancyID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vacances)) {
            return false;
        }
        Vacances other = (Vacances) object;
        if ((this.vacancyID == null && other.vacancyID != null) || (this.vacancyID != null && !this.vacancyID.equals(other.vacancyID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bean.entity.Vacances[vacancyID=" + vacancyID + "]";
    }

}
